package com.ruifu.pls.model;

import com.ruifu.pls.model.base.GLBasic;
import com.ruifu.pls.model.test.ParseJson;
import com.ruifu.pls.utils.DateUtils;
import com.ruifu.pls.utils.Native2AsciiUtils;

public class GLCallInputParam extends GLBasic {

    String method;
    String timestamp;
    String app_key;
    String md5Sigh;
    Object data;
    String app_secret;

    public GLCallInputParam() {
        //上线需要更新
        setApp_key("633f48");
        setApp_secret("B43FDFACE4C580BB7C835FC690068880");
    }

    public String getMd5Sigh() {
        return md5Sigh;
    }

    public void setMd5Sigh(String md5Sigh) {
        this.md5Sigh = md5Sigh;
    }

    public String getApp_key() {
        return app_key;
    }

    public void setApp_key(String app_key) {
        this.app_key = app_key;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getTimestamp() {
        return DateUtils.getStringDate();
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String getApp_secret() {
        return app_secret;
    }

    public void setApp_secret(String app_secret) {
        this.app_secret = app_secret;
    }

    public Object getData() {

        return data;
    }

    public void setData(Object data) {

        String temp  = "";
        try{
            temp  = ParseJson.parse(data);
            temp = Native2AsciiUtils.native2ascii(temp);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            System.out.println("对象转json错误异常");
        }
        this.data = temp;

    }


    @Override
    public String toString()
    {
        return  "method="+this.getMethod()+"&app_key="+this.getApp_key()+"&timestamp="+this.getTimestamp()+"&sign="+this.getMd5Sigh()+"&data="+this.getData()+"";
    }
}
